<?php
/**
 * @copyright:Copyright (C) 2010-2014 LiZaoNet Inc. (http://www.lizaonet.com)
 * @license: http://www.lizaonet.com
 * @link:http://www.lizaonet.com
 * @since:File available since Release v1.0
 * @Created by Azrael
 * @User: Azrael
 * @Date: 2016/1/26
 * @Time: 16:26
 *
 */

namespace Home\Model;


use Think\Model;

class FangjianModel extends Model
{
    protected $tableName = 'fangjianlist';
    protected $_scope = array(
        // 命名范围最早的
        'older'=>array(
            'order'=>'fid ASC'
        ),
    );

    /**
     * 通过ID获取房间信息
     * @param $fid
     * @return mixed
     */
    public function getInfoByFid($fid){
        $info = $this->where(array("fid"=>$fid))->find();
        return $info;
    }

    /**
     * 获取最早的房间
     * @return mixed
     */
    public function getFirstRoom(){
        $info = $this->scope("older")->find();
        return $info;
    }

}